package com.wxtech.heartbeat.model;

import java.util.Date;

import org.apache.commons.codec.binary.Hex;

import com.wxtech.heartbeat.exception.DecoderException;


public class ErrorData  {
	public static final int ERROR_CODE_INVALID_CMDTYPE = 1;
	public static final int ERROR_CODE_INVALID_CRC = 2;
	public static final int ERROR_CODE_INVALID_BIAOHAO = 3;
	public static final int ERROR_CODE_INVALID_TIME = 4;
	public static final int ERROR_CODE_INVALID_SEQ = 5;
	
	private byte[] data;
	private int errorCode;
	private long id;
	private Date insert_ts;

	public byte[] getData() {
		return data;
	}

	public void setData(byte[] data) {
		this.data = data;
	}

	public ErrorData() {
		super();
		errorCode = DecoderException.NO_ERROR;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public Date getInsert_ts() {
		return insert_ts;
	}

	public void setInsert_ts(Date insert_ts) {
		this.insert_ts = insert_ts;
	}

	public int getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(int errorCode) {
		this.errorCode = errorCode;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("ErrorData [data=").append(Hex.encodeHexString(data))
		.append(", errorCode=").append(errorCode).append("]");
		return builder.toString();
	}	
}
